{
 "cells": [
  {
   "cell_type": "code",
   "id": "initial_id",
   "metadata": {
    "collapsed": true,
    "ExecuteTime": {
     "end_time": "2025-09-06T16:23:30.891836Z",
     "start_time": "2025-09-06T16:23:30.881641Z"
    }
   },
   "source": [
    "from types import MappingProxyType\n",
    "\n",
    "a = {\"name\": \"lihua\", \"age\": 12}\n",
    "b = MappingProxyType(a)\n",
    "b"
   ],
   "outputs": [
    {
     "data": {
      "text/plain": [
       "mappingproxy({'name': 'lihua', 'age': 12})"
      ]
     },
     "execution_count": 1,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "execution_count": 1
  },
  {
   "metadata": {
    "ExecuteTime": {
     "end_time": "2025-09-06T16:23:50.312041Z",
     "start_time": "2025-09-06T16:23:50.177557Z"
    }
   },
   "cell_type": "code",
   "source": "b[\"name\"] = \"li\"",
   "id": "904432bd928e1d1c",
   "outputs": [
    {
     "ename": "TypeError",
     "evalue": "'mappingproxy' object does not support item assignment",
     "output_type": "error",
     "traceback": [
      "\u001B[0;31m---------------------------------------------------------------------------\u001B[0m",
      "\u001B[0;31mTypeError\u001B[0m                                 Traceback (most recent call last)",
      "Cell \u001B[0;32mIn[2], line 1\u001B[0m\n\u001B[0;32m----> 1\u001B[0m \u001B[43mb\u001B[49m\u001B[43m[\u001B[49m\u001B[38;5;124;43m\"\u001B[39;49m\u001B[38;5;124;43mname\u001B[39;49m\u001B[38;5;124;43m\"\u001B[39;49m\u001B[43m]\u001B[49m \u001B[38;5;241m=\u001B[39m \u001B[38;5;124m\"\u001B[39m\u001B[38;5;124mli\u001B[39m\u001B[38;5;124m\"\u001B[39m\n",
      "\u001B[0;31mTypeError\u001B[0m: 'mappingproxy' object does not support item assignment"
     ]
    }
   ],
   "execution_count": 2
  },
  {
   "metadata": {
    "ExecuteTime": {
     "end_time": "2025-09-06T16:24:00.154218Z",
     "start_time": "2025-09-06T16:24:00.152137Z"
    }
   },
   "cell_type": "code",
   "source": "a[\"name\"] = \"nnn\"",
   "id": "d4818e13c6c5c692",
   "outputs": [],
   "execution_count": 3
  },
  {
   "metadata": {
    "ExecuteTime": {
     "end_time": "2025-09-06T16:24:01.869987Z",
     "start_time": "2025-09-06T16:24:01.866528Z"
    }
   },
   "cell_type": "code",
   "source": "b",
   "id": "dcebf17fedec4d4b",
   "outputs": [
    {
     "data": {
      "text/plain": [
       "mappingproxy({'name': 'nnn', 'age': 12})"
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "execution_count": 4
  },
  {
   "metadata": {},
   "cell_type": "code",
   "outputs": [],
   "execution_count": null,
   "source": "# 并发情况，读取的使用代理，修改的才通过原来的",
   "id": "ce8019f096759a57"
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 2
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython2",
   "version": "2.7.6"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
